package org.springblade.task.base.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.task.base.entity.BaseUser;
import org.springblade.task.base.mapper.BaseUserMapper;
import org.springblade.task.base.param.BaseUserParam;
import org.springblade.task.base.service.IBaseUserService;
import org.springblade.task.base.vo.BaseUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: TODO
 * @author syncwt
 * @date ${date} ${time}
 * @version V1.0
 */
@Service
public class BaseUserServiceImpl extends ServiceImpl<BaseUserMapper, BaseUser> implements IBaseUserService {

	@Autowired
	BaseUserMapper baseUserMapper;

	/**
	 * 查询用户数
	 * @param param
	 * @return
	 */
	public Integer queryUserCount(BaseUserParam param) {

		return baseUserMapper.queryUserCount(param);
	}

	@Override
	public List<BaseUserVO> queryList(BaseUserParam param) {
		return baseUserMapper.queryList(param);
	}

	/**
	 * 查询今日登陆用户列表
	 * @param param
	 * @return
	 */
	@Override
	public List<BaseUserVO> queryTodayLoginUserList(BaseUserParam param) {

		return baseUserMapper.queryTodayLoginUserList(param);
	}

	/***
	 * 查询今日首次登陆用户数
	 * @param param
	 * @return
	 */
	public Integer queryTodayFirstLoginUserCount(BaseUserParam param) {
		return baseUserMapper.queryTodayFirstLoginUserCount(param);
	}

	/**
	 * 查询首次付费用户列表
	 * @return
	 */
	@Override
	public List<String> queryFirstPaymentUserList(String firstPaymentDate) {
		return baseUserMapper.queryFirstPaymentUserList(firstPaymentDate);
	}

	/**
	 * 批量保存更新首次付费日期
	 * @param list
	 */
	@Override
	public void saveUpdateBatchFirstPaymentDate(List<BaseUser> list) {
		baseUserMapper.saveUpdateBatchFirstPaymentDate(list);
	}

	/**
	 * 查询首次登陆前时间的用户
	 * @param param
	 * @return
	 */
	@Override
	public List<String> queryLessThanFirstLoginTime(BaseUserParam param){
		return baseUserMapper.queryLessThanFirstLoginTime(param);
	}

	/**
	 * 查询用户信息
	 * @return
	 */
	public List<BaseUserVO> queryUserList(BaseUserParam param) {
		return baseUserMapper.queryUserList(param);
	}

	/**
	 * 查询潜力用户信息
	 * @return
	 */
	public List<BaseUserVO> queryPotentialUserList() {
		return baseUserMapper.queryPotentialUserList();
	}

	/**
	 * 状态1：潜力用户
	 * @param pinList
	 */
	public void updatePotentialUserStateOne(List<String> pinList) {
		baseUserMapper.updatePotentialUserStateOne(pinList);
	}

	/**
	 * 状态2：潜力转付费用户
	 * @param pinList
	 */
	public void updatePotentialUserStateTwo(List<String> pinList) {
		baseUserMapper.updatePotentialUserStateTwo(pinList);
	}
}
